import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
import java.util.List;

public class Main {

	List<String> genericList = new ArrayList<String>();

	List simple = new ArrayList();

	/**
	 * @param args
	 * @throws NoSuchFieldException
	 * @throws SecurityException
	 */
	public static void main(String[] args) throws SecurityException,
			NoSuchFieldException {
		// get the basic information
		Field field = Main.class.getDeclaredField("genericList");
		isSpecificList(field);

		field = Main.class.getDeclaredField("simple");
		isSpecificList(field);
	}

	protected static Class isSpecificList(Field field) {
		Type type = field.getGenericType();
		if (type instanceof ParameterizedType) {
			ParameterizedType ptype = (ParameterizedType) field
					.getGenericType();
			Type[] targs = ptype.getActualTypeArguments();
			if (targs == null || targs.length == 0)
				return null;
			for (int j = 0; j < targs.length; j++) {
				Class tclas = (Class) targs[j];
				return tclas;
			}
		} else
			return null;
		return null;
	}
}
